def averageLessThan(list: List[Int], n: Int): Double = {
  // 过滤出小于n的数
  val filteredList = list.filter(_ < n)
  // 如果过滤后为空，返回0
  if (filteredList.isEmpty) {
   0 
  }
  // 否则，计算平均值
  else {
    filteredList.sum.toDouble / filteredList.length.toDouble
  }
}

